/**
  ******************************************************************************
  * @file    IMU/algorithm/inc/sensor_algorithm.h
  * @author  Zhang Xiaodong
  * @version V0.1.0
  * @date    11-April-2020
  * @brief   sensor algorithm header file
  ******************************************************************************
  * @attention
  *
  * <h2><center>&copy; COPYRIGHT 2020 BeyondBits</center></h2>
  *
  *
  ******************************************************************************
 */

#ifndef __SENSORALGOR_H
#define __SENSORALGOR_H

#include "main.h"

#define CALISAMPLECNT 50  //calibration sample count
/*
windowsize    factor(in fix16_t)
    4         (0x00004000)
    8         (0x00002000)
    16        (0x00001000)

*/
#define BB_MAF_WINDOWSIZE 8
#define BB_MAF_FACTOR ((fix16_t)0x00002000)//for window size 8

//#define BB_FIX_TO_FLOAT(x) ((float)(x) / BBALGSCALE / ((float)BB_FIX_ONE))

//define the RAW Date read from sensor
typedef struct {
  int16_t xraw;
  int16_t yraw;
  int16_t zraw;
} ThreeAxisDate_TypeDef;


BB_StatusTypeDef bb_alg_init(void);
BB_StatusTypeDef bb_maf(int16_t* MagnetRawAd,fix16_t* mag_maf,uint8_t maf_en);
/**
  * @}
  */

/**
  * @}
  */

#endif //__SENSORALGOR_H
/************************ (C) COPYRIGHT BeyondBits *****END OF FILE****/
